#include <stdio.h>

#include <QtGui/QMessageBox>

#include <libz800.h>

#include "MainWindow.h"

int main(int argc, char **argv)
{
	setvbuf(stdout, NULL , _IOLBF , 1024);
	setvbuf(stderr, NULL , _IOLBF , 1024);

	z800_device *dev = z800_connect(5);

	QApplication app(argc, argv);

	QApplication::setOrganizationName("libz800");
	QApplication::setApplicationName("Z800 Calibration Tool");

	if(dev == NULL)
	{
		QMessageBox::critical(NULL,
				      "Z800 Calibration Tool",
				      "Connection to Z800 failed");
		return EXIT_FAILURE;
	}

	MainWindow *mainWindow = new MainWindow(dev);
	mainWindow->show();
	return app.exec();
}
